<template>
<div class="imagebox" :style="styleColor">
  <img
      :style="imgStyle"
      :src="imageAdress"
      alt=""
    />
</div>
</template>

<script>
export default {
  name: 'widgetDevice4',
  props: {
    value: Object,
    ispreview: Boolean
  },
  components: {},
  data() {
    return {
      options: {},
      imageAdress:require('../../image/二沉池.svg')
    }
  },
  computed: {
    imgStyle() {
      return {
        width:'100%',
        height:'100%',
        opacity: this.transStyle.transparency / 100,
        transform: `scaleX(${this.transStyle.leftRightImage?'-1':'1'}) scaleY(${this.transStyle.topButtomImage?'-1':'1'})`
      };
    },
    transStyle() {
      return this.objToOne(this.options);
    },
    styleColor() {
      return {
        position: this.ispreview ? "absolute" : "static",
        background: this.transStyle.background,
        "text-align": this.transStyle.textAlign,
        width: this.transStyle.width + "px",
        height: this.transStyle.height + "px",
        left: this.transStyle.left + "px",
        top: this.transStyle.top + "px",
        right: this.transStyle.right + "px"
      };
    },
  },
  watch: {
    value: {
      handler(val) {
        this.options = val;
      },
      deep: true
    }
  },
  created() {
    this.options = this.value;
  },
  mounted() {},
  methods: {}
}
</script>

<style lang="scss" scoped>
.imagebox {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
</style>
